﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DBTMDT.Dal;

namespace DBTMDT.Biz
{
    class BizPhienDau
    {
        public int IDPhienDau { get; set; }
        public string MaPhienDau { get; set; }
        public Decimal GiaHienTai { get; set; }
        public Decimal BuocGiaPhienDau { get; set; }
        public DateTime ThoiGianHienTai { get; set; }
        public string TrangThaiPhienDau { get; set; }
        public bool AutoBid { get; set; }
        public BizUser IdUser { get; set; }
        public int SoCoinDau { get; set; }
        public BizSanPham IdSanPham { get; set; }
        public BizGoiBid IdGoiBid { get; set; }

        public BizPhienDau()
        {
            this.IDPhienDau = -1;
            this.IdUser = new BizUser();
            this.IdSanPham = new BizSanPham();
            this.IdGoiBid = new BizGoiBid();
        }

        public BizPhienDau(int IDPhienDau, string MaPhienDau, Decimal GiaHienTai,
            Decimal BuocGiaPhienDau, DateTime ThoiGianHienTai, string TrangThaiPhienDau, bool AutoBid,
            BizUser IdUer, int SoCoinDau, BizSanPham IdSanPham, BizGoiBid IdGoibid
            )
        {
            this.IDPhienDau = IDPhienDau;
            this.MaPhienDau = MaPhienDau;
            this.GiaHienTai = GiaHienTai;
            this.BuocGiaPhienDau = BuocGiaPhienDau;
            this.ThoiGianHienTai = ThoiGianHienTai;
            this.TrangThaiPhienDau = TrangThaiPhienDau;
            this.AutoBid = AutoBid;
            this.IdUser = IdUser;
            this.SoCoinDau = SoCoinDau;
            this.IdSanPham = IdSanPham;
            this.IdGoiBid = IdGoiBid;

        }


        public BizPhienDau( string MaPhienDau, Decimal GiaHienTai,
         Decimal BuocGiaPhienDau, DateTime ThoiGianHienTai, string TrangThaiPhienDau, bool AutoBid,
         BizUser IdUer, int SoCoinDau, BizSanPham IdSanPham, BizGoiBid IdGoibid
         )
        {
            this.MaPhienDau = MaPhienDau;
            this.GiaHienTai = GiaHienTai;
            this.BuocGiaPhienDau = BuocGiaPhienDau;
            this.ThoiGianHienTai = ThoiGianHienTai;
            this.TrangThaiPhienDau = TrangThaiPhienDau;
            this.AutoBid = AutoBid;
            this.IdUser = IdUser;
            this.SoCoinDau = SoCoinDau;
            this.IdSanPham = IdSanPham;
            this.IdGoiBid = IdGoiBid;

        }

        public void Save()
        {
            if (this.IDPhienDau == -1)
                this.IDPhienDau = DalPhienDau.Insert(this);
            else
                DalPhienDau.Update(this);
        }

    }
}
